Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

178
Views
How to update this JSON string with \" so it can be JSON.parse()?

So got this JSON string,

{
    "Text": "<?xml version=\"1.0\"</pi>",
    "Type": "Checkin"
}

I need to deserialize it back to an object.

var returnedFileContent = '{"Text": "<?xml version=\"1.0\"</pi>","Type": "Checkin"}';
var test10 = JSON.parse(returnedFileContent);
console.log(test10)

Error:

Unexpected number in JSON at position 25

I know JS doesn't like the \" and it will work if the JSON string is:

{
    "Text": "<?xml version=\\\\\\" 1.0\\\\\\ "</pi>",
    "Type": "Checkin"
}

The problem is how to convert the \" to \\\".

Note: I have no control of the input JSON String.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!